package pl.com.like.sequoia.web.vo;

/**
 * Front-end interface of handled search objects.
 * 
 * @author Pawel Wolanski
 * 
 */
public enum SearchType {

	// GENBANK("genbank"), FASTA("fasta"),
	PDB("pdb");

	private String searchType;

	private SearchType(String type) {
		searchType = type;
	}

	/**
	 * default value in system, when user not define object type.
	 * 
	 * @return
	 */
	public SearchType defaultValue() {
		return PDB;
	}

	public String getSearchType() {
		return searchType;
	}

	/**
	 * translate user value to enum.
	 * 
	 * @param value
	 *            inserted by user
	 * @return equivalent in system
	 */
	public SearchType toEnum(String value) {
		for (SearchType item : values()) {
			if (value.equals(item.searchType))
				return item;
		}
		return defaultValue();
	}

}
